<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\DbConnection\Model\Model;
use Qbhy\HyperfAuth\Authenticatable;

/**
 * @property int $admin_id 
 * @property string $username 
 * @property string $password 
 * @property string $add_time 
 */
class Admin extends Model implements Authenticatable
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'admin';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['admin_id' => 'integer'];

    protected $primaryKey = "admin_id";

    protected $hidden = ['password'];

    public $timestamps = false;

    public function getId()
    {
        return $this->admin_id;
    }

    public static function retrieveById($key): ?Authenticatable
    {
        return self::query()->find($key);
    }
}